package Merlion.SCM.entity;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

@Entity
@DiscriminatorValue(value="RAW")
public class MaterialEntity extends InventoryEntity {
    private int leadTime; //in weeks
    private int lotSize;
    private String lotSizeUnit;

    public int getLotSize() {
        return lotSize;
    }

    public void setLotSize(int lotSize) {
        this.lotSize = lotSize;
    }

    public String getLotSizeUnit() {
        return lotSizeUnit;
    }

    public void setLotSizeUnit(String lotSizeUnit) {
        this.lotSizeUnit = lotSizeUnit;
    }

    public MaterialEntity() {
        this.inventoryType = "RAW";
    }

    public MaterialEntity(String name, String description, int leadTime, int shelfLife, int lotSize, String lotSizeUnit) {
        this.name = name;
        this.description = description;
        this.leadTime = leadTime;
        this.shelfLife = shelfLife;
        this.lotSize = lotSize;
        this.lotSizeUnit = lotSizeUnit;
        this.inventoryType = "RAW";
    }

    public int getLeadTime() {
        return leadTime;
    }

    public void setLeadTime(int leadTime) {
        this.leadTime = leadTime;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaterialEntity)) {
            return false;
        }
        MaterialEntity other = (MaterialEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mrp.IngredientEntity[ id=" + id + " ]";
    }
    
}
